<!DOCTYPE html>
<html>
    <head>
        <title>Auto Py To Exe</title>
        <script type="text/javascript" src="/eel.js"></script>
        <script type="text/javascript" src="/script.js"></script>
        <link rel="stylesheet" href="/styles.css">
    </head>

    <body>
        <div id="header">
            <a href="https://github.com/brentvollebregt/auto-py-to-exe" target="_blank"><img src="/favicon.ico"></a>
            <a href="https://github.com/brentvollebregt/auto-py-to-exe" target="_blank"><h1>Auto Py to Exe</h1></a>
        </div>
        <div id="mid">
            <div id="content">
                <div id="info_bar">
                    <p>Auto Py to Exe easily converts python scripts to executable files.</p>
                    <p style="margin-top: 8px;">Simply select your script location and choose other settings that are given in the GUI. When finished click the big blue convert button and wait while the output is displayed.</p>
                    <p style="margin-top: 8px;">The output will say when it is complete and you will be able to clear the output if you want to make a small change and re-convert.</p>
                </div>
                <div id="converter_settings">
                    <h1 class="section_header">Script Location</h1>
                    <div style="display: grid; grid-gap: 4px; grid-template-columns: 1fr 120px;">
                        <input id="file" onkeyup="checkFile(this)" placeholder="Path to file" required>
                        <button class="btn_search" onclick="getFile('file', 'python')">Browse</button>
                    </div>

                    <h1 class="section_header">Onefile</h1>
                    <button id="onefile_inactive" class="btn_choice" onclick="switchOnefile(false)">One Directory</button>
                    <button id="onefile_active" class="btn_choice btn_choice_greyed" onclick="switchOnefile(true)">One File</button>

                    <h1 class="section_header">Console Window</h1>
                    <button id="console_active" class="btn_choice" onclick="switchConsole(true)">Console Based</button>
                    <button id="console_inactive" class="btn_choice btn_choice_greyed" onclick="switchConsole(false)">Window Based (hide the console)</button>

                    <h1 class="section_header">
                        <a class="expand" data-expand="icon_content" data-display="grid" onclick="expand(this)"></a>
                        <a class="noselect" onclick="expand(this.previousElementSibling)">Icon</a>
                    </h1>
                    <div id="icon_content" style="display: none; grid-gap: 4px; grid-template-columns: 1fr 120px;">
                        <input id="icon" placeholder=".ico file" onkeyup="checkFile(this)">
                        <button class="btn_search" onclick="getFile('icon', 'icon')">Browse</button>
                    </div>

                    <h1 class="section_header">
                        <a class="expand" data-expand="additional_files_content" onclick="expand(this)"></a>
                        <a class="noselect" onclick="expand(this.previousElementSibling)">Additional Files</a>
                    </h1>
                    <div id="additional_files_content" style="display: none;">
                        <button class="btn_search" onclick="additionalFilesAddFiles()" style="margin: 0 0 5px 6px;">Add Files</button>
                        <button class="btn_search" onclick="additionalFilesAddFolder()">Add Folder</button>
                        <button class="btn_search" onclick="additionalFilesAdd('', '.')">Add Blank</button><br>
                        <p id="onefileAdditionalFilesNote" class="note" style="display: none;">Be careful when using additional files with onefile mode; <a href="https://stackoverflow.com/questions/7674790/bundling-data-files-with-pyinstaller-onefile/13790741#13790741" style="text-decoration: none;">read this</a> and update your code to work with pyinstaller.</p>
                        <p class="note">If you want to put additional files in the root directory, put a period (.) in the destination.</p>
                    </div>

                    <h1 class="section_header">
                        <a class="expand" data-expand="advanced_content" onclick="expand(this)"></a>
                        <a class="noselect" onclick="expand(this.previousElementSibling)">Advanced</a>
                    </h1>
                    <div id="advanced_content" style="display: none;">
                        <div style="display: grid; grid-gap: 4px; grid-template-columns: 130px 1fr 120px; margin-bottom: 2px;">
                            Output Directory:
                            <input id="output_location" placeholder="Folder path" onkeyup="checkFolder(this)">
                            <button class="btn_search" onclick="getFolder('output_location')">Browse</button>
                        </div>
                        <button id="disable_recursion_limit" class="btn_choice btn_choice_greyed">Disable Recursion Limit Helper<span class="info_btn" title="By default the recursion limit is set to 5000; this disables the limit. If not set, sys.setrecursionlimit(5000) is called."></span></button>
                        <h2 class="sub_header">General Options</h2>
                        --upx-dir<input id="VALUE--upx-dir" placeholder="UPX_DIR" onkeyup="checkFolder(this)"><button class="btn_search" onclick="getFolder('VALUE--upx-dir')">Browse</button><span class="info_btn" title="Path to UPX utility (default: search the execution path)"></span>
                        <br><button id="OPTION-a" class="btn_choice btn_choice_greyed">-a Don't include unicode encoding support<span class="info_btn" title="Do not include unicode encoding support (default: included if available)"></span></button>
                        <br><button id="OPTION--clean" class="btn_choice btn_choice_greyed">--clean Clean PyInstaller before building<span class="info_btn" title="Clean PyInstaller cache and remove temporary files before building"></span></button>
                        <br>--log-level<input id="VALUE--log-level" placeholder="LEVEL"><span class="info_btn" title="Amount of detail in build-time console messages. LEVEL may be one of TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL (default: INFO)."></span>
                        <br>-n<input id="VALUE-n" placeholder="NAME"><span class="info_btn" title="Name to assign to the bundled app and spec file (default: first script’s basename)"></span>
                        <h2 class="sub_header">What to bundle, where to search</h2>
                        --add-binary<input id="VALUE--add-binary" placeholder="<SRC;DEST or SRC:DEST>"><span class="info_btn" title="Additional binary files to be added to the executable. This option can be used multiple times. Define --add-binary in extra command data again to add more than one additional binary file."></span>
                        <br>-p<input id="VALUE-p" placeholder="DIR"><span class="info_btn" title="A path to search for imports (like using PYTHONPATH). Multiple paths are allowed, separated by ‘:’, or use this option multiple times."></span>
                        <br>--hidden-import<input id="COMMASPLIT--hidden-import" placeholder="MODULENAME"><span class="info_btn" title="Name an import not visible in the code of the script(s). This option can be used multiple times. Commas can be used to split package names in this input field (will be split later)."></span>
                        <br>--additional-hooks-dir<input id="VALUE--additional-hooks-dir" placeholder="HOOKSPATH" onkeyup="checkFolder(this)"><button class="btn_search" onclick="getFolder('VALUE--additional-hooks-dir')">Browse</button><span class="info_btn" title="	An additional path to search for hooks. This option can be used multiple times."></span>
                        <br>--runtime-hook<input id="VALUE--runtime-hook" placeholder="RUNTIME_HOOKS"><span class="info_btn" title="Path to a custom runtime hook file. A runtime hook is code that is bundled with the executable and is executed before any other code or module to set up special features of the runtime environment. This option can be used multiple times."></span>
                        <br>--exclude-module<input id="COMMASPLIT--exclude-module" placeholder="EXCLUDES"><span class="info_btn" title="Optional module or package (the Python name, not the path name) that will be ignored (as though it was not found). This option can be used multiple times. Commas can be used to split package names in this input field (will be split later)."></span>
                        <br>--key<input id="VALUE--key" placeholder="KEY"><span class="info_btn" title="The key used to encrypt Python bytecode. Must have the PyCrypto module installed. The key-string is a string of 16 characters which is used to encrypt each file of Python byte-code before it is stored in the archive inside the executable file."></span>
                        <h2 class="sub_header">How to generate</h2>
                        --debug<select id="VALUE--debug">
                            <option value=""></option>
                            <option value="all">all</option>
                            <option value="imports">imports</option>
                            <option value="bootloader">bootloader</option>
                            <option value="noarchive">noarchive</option>
                        </select><span class="info_btn" title="Provide assistance with debugging a frozen application, by specifying one or more of {all,imports,bootloader,noarchive}."></span>
                        <br><button id="OPTION-s" class="btn_choice btn_choice_greyed">-s Apply a symbol-table strip to the executable and shared libs<span class="info_btn" title="Apply a symbol-table strip to the executable and shared libs (not recommended for Windows)"></span></button>
                        <br><button id="OPTION--noupx" class="btn_choice btn_choice_greyed">--noupx Do not use UPX even if it is available<span class="info_btn" title="Do not use UPX even if it is available (works differently between Windows and *nix)"></span></button>
                        <h2 class="sub_header">Windows specific options</h2>
                        --version-file<input id="VALUE--version-file" placeholder="FILE" onkeyup="checkFile(this)"><button class="btn_search" onclick="getFile('VALUE--version-file', '')">Browse</button><span class="info_btn" title="Add a version resource from FILE to the exe"></span>
                        <br>-m<input id="VALUE-m" placeholder="<FILE or XML>" onkeyup="checkFile(this)"><button class="btn_search" onclick="getFile('VALUE-m', '')">Browse</button><span class="info_btn" title="Add manifest FILE or XML to the exe"></span>
                        <br>-r<input id="VALUE-r" placeholder="RESOURCE"><span class="info_btn" title="Add or update a resource to a Windows executable. The RESOURCE is one to four items, FILE[,TYPE[,NAME[,LANGUAGE]]]. FILE can be a data file or an exe/dll. For data files, at least TYPE and NAME must be specified. LANGUAGE defaults to 0 or may be specified as wildcard * to update all resources of the given TYPE and NAME. For exe/dll files, all resources from FILE will be added/updated to the final executable if TYPE, NAME and LANGUAGE are omitted or specified as wildcard *.This option can be used multiple times."></span>
                        <br><button id="OPTION--uac-admin" class="btn_choice btn_choice_greyed">--uac-admin Creates a Manifest which will request elevation<span class="info_btn" title="Using this option creates a Manifest which will request elevation upon application restart."></span></button>
                        <br><button id="OPTION--uac-uiaccess" class="btn_choice btn_choice_greyed">--uac-uiaccess Allows an elevated application to work with Remote Desktop<span class="info_btn" title="Using this option allows an elevated application to work with Remote Desktop."></span></button>
                        <h2 class="sub_header">Windows Side-by-side Assembly searching options</h2>
                        <button id="OPTION--win-private-assemblies" class="btn_choice btn_choice_greyed">--win-private-assemblies<span class="info_btn" title="Any Shared Assemblies bundled into the application will be changed into Private Assemblies. This means the exact versions of these assemblies will always be used, and any newer versions installed on user machines at the system level will be ignored."></span></button>
                        <br><button id="OPTION--win-no-prefer-redirects" class="btn_choice btn_choice_greyed">--win-no-prefer-redirects<span class="info_btn" title="While searching for Shared or Private Assemblies to bundle into the application, PyInstaller will prefer not to follow policies that redirect to newer versions, and will try to bundle the exact versions of the assembly."></span></button>
                        <h2 class="sub_header">Mac OS X specific options</h2>
                        --osx-bundle-identifier<input id="VALUE--osx-bundle-identifier" placeholder="BUNDLE_IDENTIFIER"><span class="info_btn" title="Mac OS X .app bundle identifier is used as the default unique program name for code signing purposes. The usual form is a hierarchical name in reverse DNS notation. For example: com.mycompany.department.appname (default: first script’s basename)"></span>
                        <h2 class="sub_header">Rarely used special options</h2>
                        --runtime-tmpdir<input id="VALUE--runtime-tmpdir" placeholder="PATH" onkeyup="checkFolder(this)"><button class="btn_search" onclick="getFolder('VALUE--runtime-tmpdir')">Browse</button><span class="info_btn" title="Where to extract libraries and support files in onefile-mode. If this option is given, the bootloader will ignore any temp-folder location defined by the run-time OS. The _MEIxxxxxx-folder will be created here. Please use this option only if you know what you are doing."></span>
                        <br><button id="OPTION--bootloader-ignore-signals" class="btn_choice btn_choice_greyed">--bootloader-ignore-signals<span class="info_btn" title="Tell the bootloader to ignore signals rather than forwarding them to the child process. Useful in situations where e.g. a supervisor process signals both the bootloader and child (e.g. via a process group) to avoid signalling the child twice."></span></button>
                        <h2 class="sub_header">Manual Command Entry</h2>
                        <div style="display: grid; grid-gap: 4px; grid-template-columns: 160px 1fr; margin-top: 2px;">
                            Extra Command Data:
                            <input id="extra_command_data" onkeyup="generateCurrentCommand()" placeholder="Flags and extra data (use this to add a flag more than once)">
                        </div>
                        <h2 class="sub_header">Configuration Import and Export<span class="info_btn" title="Save and load the current state of the inputs/switches in the UI. This saves you from having to setup the same thing evey time."></span></h2>
                        Import Config From:
                        <button class="btn_search" onclick="importConfigFromJSONFile()">JSON File</button>
                        <button class="btn_search" onclick="importConfigFromClipboard()">Clipboard</button>
                        <br>
                        Export Config To:
                        <button class="btn_search" onclick="exportConfigToJSONFile()" style="margin-top: 2px;">JSON File</button>
                        <button class="btn_search" onclick="exportConfigToClipboard()" style="margin-top: 2px;">Clipboard</button>
                    </div>

                    <h1 class="section_header">Current Command</h1>
                    <textarea id="current_command" style="width: 100%;" readonly></textarea>

                    <div id="output" style="display: none;">
                        <h1 class="section_header">Output</h1>
                        <textarea style="width: 100%; white-space: pre; overflow-y: hidden;"></textarea>
                    </div>

                    <div id="common-issue-link">
                        Something wrong with your exe? Read <a href="https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/" target="_blank">this post on how to fix common issues</a> for possible solutions.
                    </div>

                    <div id="btm_main_wrapper">
                        <button id="convert" class="btn_main" onclick="convert()">Convert .py to .exe</button>
                        <button id="openOutput" class="btn_main" style="display: none;" onclick="openOutputFolder()">Open Output Folder</button>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
